//  ========== 
//  = 我的借款产品列表 业务JS = 
//  ==========
var bidId;
var Main = function(){
	mui.init({
		swipeBack:true 		//启用右滑关闭功能
	});
	this.init();
	this.loadData();
};
Main.prototype = {
	init : function(){
		mui('.mui-scroll-wrapper').scroll({
					indicators: true //是否显示滚动条
		});
		var _this = this;
		_this.eventInit()
		
	},
	eventInit : function(){//绑定事件
		var _this = this;
        
	},

	//内容列表
	loadData : function(_callback){
		var _this = this;
		bidId = Util.requestURL('bidId');
		var param = {
				isMobile:1,
				memberId:Util.getLoginUser().memberId,
				str:bidId+",loan"
				};
		var url = server_url+'/user/loanRepayMentPlanBpCustMember.do';
		$.getJSON(url,param  ,function(data){
			var _html = '';
			if(data.success){
	           for(var i=0;i<data.result.length;i++){
	            	var item = data.result[i];
					_html += '\n <li class="mui-table-view-cell ">';
		            _html += '\n <h5 >期数:'+item.payintentPeriod+'期</h5>';
		            _html += '\n <h5>计划本息金额:¥'+item.intenttotal+'</h5>';
		            var factMoney = "";
		            if(item.backmoney==0){
		            	if(item.loanerRepayMentStatus==1){
		            		factMoney = item.repaymentTotal;
		            	}else{
		            		factMoney = 0;
		            	}
		            }else{
		            	factMoney = item.backmoney;
		            }
		            _html += '\n <h5>实际回款金额:¥'+factMoney+'</h5>';
		            _html += '\n <h5>计划到账日:'+Util.safeString(item.intentDate).replace('00:00:00','')+'</h5>';
		            _html += '\n <h5>实际到账日:'+Util.safeString(item.factDate,'-- --')+'</h5>';
		            var status = '';
		            if(item.repaymentTotal==0){
		            	status='已回款';
		            }else if(item.loanerRepayMentStatus==1){
		            	status='已回款';
		            }else{
		            	status='未回款';
		            }
		            _html += '\n <h5 >回款状态:'+status+'</h5>';
				    _html += '\n </li>';
				}	
            }			
             $('.m-item-list').append(_html);
             
             if($.isFunction(_callback)){
             	_callback();
             }
		});
	}
	
}
